-
Notifications
You must be signed in to change notification settings - Fork 23
Insert with specific unique constraint #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert with specific unique constraint #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rcarver Thanks for this! We finally had a chance to figure out the surface area of all the changes needed and I've pushed them to your branch. Basically:
- Update all
insert
s to take trailing closures for inserted records. This makes it clearer that the next trailing closure is theonConflict
closure in those cases. - Update all existing
onConflict
closures to the more descriptiveonConflictDoUpdate
- Deprecate the existing
insert
functions in favor of the above changes.
Brandon and I will discuss the final details and hopefully merge soon!
@stephencelis oh nice, the consistent trailing closure syntax is great! |
This adds an overload of
insert
where you can specify a specific unique constraint. Currently, upsert behavior is only available for primary key tables, on the primary key.Given a table with additional unique constraint:
You can upsert by specifying those columns: